import React, { useEffect } from 'react'
import { useDispatch } from 'react-redux';
import { useNavigate } from 'react-router-dom';
import { Toast, NavBar } from 'react-vant';
import { Cell } from 'react-vant';
import { saveUserId } from '../../store/userSlice';

export default function My() {

  let dispatch = useDispatch()
  let navigate = useNavigate()
  const remove = () => {
    localStorage.removeItem('token')
    saveUserId(dispatch(saveUserId('')))
    console.log(666);
    navigate('/home')
  }

  useEffect(() => {

  }, [])

  return (
    <div>
      <NavBar
        title="个人中心"
        leftText="返回"
        rightText="注销"
        onClickLeft={() => navigate(-1)}
        onClickRight={() => remove()}
      />

      <>
        <Cell.Group title='个人中心' card>
          <Cell title='地址管理' isLink />
          <Cell title='订单中心' isLink />
        </Cell.Group>
      </>
    </div>
  )
}
